﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;

namespace RestaurantBooker.View
{
    public partial class LoginPage : UserControl
    {
        public LoginPage()
        {
            InitializeComponent();

                                 
#if !DEBUG
            // clear password if not in DEBUG mode
            tbUserName.Text = "";
            tbPassword.Password = "";
#endif
        }

        private void tbUserName_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                tbUserName.GetBindingExpression(TextBox.TextProperty).UpdateSource();
                btnLogin.Command.Execute(null);
            }
        }

        private void tbPassword_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                tbPassword.GetBindingExpression(PasswordBox.PasswordProperty).UpdateSource();
                btnLogin.Command.Execute(null);
            }
        }
    }
}

